package yunjiao.designpatterns.interpreter.expr;

import yunjiao.designpatterns.interpreter.Employee;

/**
 * 名称表达式
 *
 * @author yangyunjiao
 */
public class NameExpression extends TerminalExpression {

    protected String name;

    public NameExpression(String name) {
        this.name = name;
    }

    @Override
    public boolean interpret(Employee context) {
        return context.getEmployeeName().equalsIgnoreCase(name);
    }

    @Override
    public String toString() {
        return "NameExpression [name=" + name + "]";
    }
}
